<template>
	<gui-page ref="guiPage" :customHeader="true">
		<template v-slot:gHeader>
			<nav-bar-custom left-icon="left" :title="$t('distributedEnter.scanRecord')"></nav-bar-custom>
		</template>
		<template v-slot:gBody>
			<view v-if="data.spScanList.length==0" class="noticeHooks">
				{{data.spScanList.length == 0 ? $t('stockManage.notAvailable') : $t('stockManage.without')}}
			</view>
			<template v-for="(el,i) in data.spScanList" :key="`${el.storeId}` + `${i}`" v-else>
				<!-- <view v-for="(item,index) in el.arr" :key="`${item.barcode}` + `${index}`" class="record-card">
					<uni-icons class="close-icons" type="closeempty" color="#9C9C9C" size="30"  @click="handelClosePopup(i,index)"></uni-icons>
					<view class="custom-card-itemOne">
						<text class="item-info-title">条码号：</text>{{item.barcode}}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">物料名称：</text>{{item.materialName}}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">物料代码：</text>{{item.materialCode}}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">本次扫描数量：：</text>{{item.currentQty}}
					</view>
					<view v-if="item.repaetTypeCode != null && item.repaetTypeCode == 'ReceivingForPlay'"  class="custom-card-itemOne">
						<text class="item-info-title">赠送数量：</text>{{item.currentQty}}
					</view>
				</view> -->
				<view class="record-card" v-for="(item,index) in el.arr" :key="`${item.barcode}` + `${index}`">
					<uni-icons class="close-icons" type="closeempty" color="#9C9C9C" size="30" @click="handelClosePopup(i,index,item)"></uni-icons>
					<view class="card-mini-head">
						<view class="title-line"></view>
						<text>{{$t('translationImage.serialNumber')}}：{{ el.arr.length-index}}</text>
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('hardware.materialCard')}}：</text>{{ item.barcode }}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('distributedEnter.materialCode')}}：</text>{{ item.materialCode }}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('distributedEnter.materialName')}}：</text>{{ item.materialName }}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('distributedEnter.materialSpec')}}：</text>{{ item.materialSpec || '' }}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('distributedEnter.uom')}}：</text>{{ item.unit }}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('distributedOut.warehouse')}}：</text>{{ item.warehouseCode }}
					</view>
					<view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('distributedOut.location')}}：</text>{{ item.locationCode }}
					</view>
					<!-- <view class="custom-card-itemOne">
						<text class="item-info-title">{{$t('stockManage.giveQty')}}：</text>{{ item.sendNum }}
					</view> -->
					<view class="custom-card-itemOne">
						<text class="item-info-title" style="color:#dd524d">{{$t('hardware.thisWarehousingQty')}}：</text>{{ item.currentQty }}
					</view>
			    </view>
			</template>
		</template>
	</gui-page>
</template>

<script setup>
	import { navigate } from '@/utils/routerSkip.js';
	import { useStore } from "vuex";
	import { basPdaOperationLogFn } from '@/utils/index.js';
	import { OPERATION_DEL, OPERATION_LOOK } from '@/constant/index.js'
	import {
		computed,
		reactive,
		onMounted
	} from 'vue';
	onMounted(()=>{
		try {
			let inputParameter = '无'
			let returnParameter = JSON.stringify(data.spScanList)
			let operationPicture = '五金仓入库'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_LOOK
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
	})
	let data = reactive({
		spScanList:[],
	})
	let store = useStore();
	// fqc扫描条码
	data.spScanList = computed(() => {
		return store.state.hardWare.spScanList
	})
	const handelClosePopup = (i,index,item) => {
		// 标记当前的索引 去删除相对应的数据
		let num = {
			i:i,
			index:index
		}
		try {
			let inputParameter = JSON.stringify(item)
			let returnParameter = '无'
			let operationPicture = '五金仓入库'
			let callInterface = '无'
			let opertionParmes = {
				inputParameter,
				returnParameter,
				operationPicture,
				callInterface,
				responseCode:'无',//返回状态
				errorMessage:'无',//错误信息
				isPass:'Y',//是否成功 Y N
				operationType:OPERATION_DEL
			}
			basPdaOperationLogFn(opertionParmes)
		} catch (error) {
		}
		store.dispatch('hardWare/delSpScanListItem',num)
	}
</script>

<style>

</style>
